package model

import (
	"gorm.io/gorm"
	"time"
)


type Client struct {
	ID         int64          `gorm:"primary_key;column:ID;type:bigint(20);not null" json:"id"`
	Name       string         `gorm:"column:name;type:varchar(128);not null" json:"name"`
	TaxID      string         `gorm:"column:tax_id;type:varchar(128);not null" json:"tax_id"`
	Status     int            `gorm:"column:status;type:int(11);not null" json:"status"`
	Level      int            `gorm:"column:level;type:int(11);not null" json:"level"`
	LocationID int64          `gorm:"column:location_id;type:bigint(20);not null" json:"location_id"`
	CreatedAt  time.Time      `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
	UpdatedAt  time.Time      `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
	DeletedAt  gorm.DeletedAt `gorm:"column:deleted_at;type:datetime" json:"deleted_at"`
}


type Confiscate struct {
	ID             int64          `gorm:"primary_key;column:ID;type:bigint(20);not null" json:"id"`
	LocationID     int64          `gorm:"column:location_id;type:bigint(20);not null" json:"location_id"`
	Type           int            `gorm:"column:type;type:int(11);not null" json:"type"`
	State          int            `gorm:"column:state;type:int(11);not null" json:"state"`
	Name           string         `gorm:"column:name;type:varchar(32);not null" json:"name"`
	Price          string         `gorm:"column:price;type:varchar(32);not null" json:"price"`
	MaterialID     string         `gorm:"column:material_id;type:varchar(32);not null" json:"material_id"`
	Weight         string         `gorm:"column:weight;type:varchar(32);not null" json:"weight"`
	WeightRecordID string         `gorm:"column:weight_record_id;type:varchar(32);not null" json:"weight_record_id"`
	CreatedAt      time.Time      `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
	UpdatedAt      time.Time      `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
	DeletedAt      gorm.DeletedAt `gorm:"column:deleted_at;type:datetime" json:"deleted_at"`
}


type LogisticsTask struct {
	ID            int64          `gorm:"primary_key;column:ID;type:bigint(20);not null" json:"id"`
	Type          int            `gorm:"column:type;type:int(11);not null" json:"type"`
	State         int            `gorm:"column:state;type:int(11);not null" json:"state"`
	SalesOrderID  int64          `gorm:"column:sales_order_id;type:bigint(20);not null" json:"sales_order_id"`
	ProduceTaskID int64          `gorm:"column:produce_task_id;type:bigint(20);not null" json:"produce_task_id"`
	ConfiscateID  int64          `gorm:"column:confiscate_id;type:bigint(20);not null" json:"confiscate_id"`
	StartTime     time.Time      `gorm:"column:start_time;type:datetime;not null" json:"start_time"`
	StopTime      time.Time      `gorm:"column:stop_time;type:datetime;not null" json:"stop_time"`
	ExpectPathID  int64          `gorm:"column:expect_path_id;type:bigint(20);not null" json:"expect_path_id"`
	CreatedAt     time.Time      `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
	UpdatedAt     time.Time      `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
	DeletedAt     gorm.DeletedAt `gorm:"column:deleted_at;type:datetime" json:"deleted_at"`
}


type LogisticsTaskCheck struct {
	ID              int64          `gorm:"primary_key;column:ID;type:bigint(20);not null" json:"id"`
	LogisticsTaskID int64          `gorm:"column:logistics_task_id;type:bigint(20);not null" json:"logistics_task_id"`
	AccountID       int64          `gorm:"column:account_id;type:bigint(20);not null" json:"account_id"`
	Result          int            `gorm:"column:result;type:int(11);not null" json:"result"`
	CreatedAt       time.Time      `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
	UpdatedAt       time.Time      `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
	DeletedAt       gorm.DeletedAt `gorm:"column:deleted_at;type:datetime" json:"deleted_at"`
}


type ProduceRecord struct {
	ID        int64          `gorm:"primary_key;column:ID;type:bigint(20);not null" json:"id"`
	CreatedAt time.Time      `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
	UpdatedAt time.Time      `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime" json:"deleted_at"`
}


type ProduceTask struct {
	ID        int64          `gorm:"primary_key;column:ID;type:bigint(20);not null" json:"id"`
	CreatedAt time.Time      `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
	UpdatedAt time.Time      `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime" json:"deleted_at"`
}


type Product struct {
	ID          int64          `gorm:"primary_key;column:ID;type:bigint(20);not null" json:"id"`
	Code        string         `gorm:"column:code;type:varchar(64);not null" json:"code"`
	Name        string         `gorm:"column:name;type:varchar(256);not null" json:"name"`
	Description string         `gorm:"column:description;type:varchar(512);not null" json:"description"`
	Price       float64        `gorm:"column:price;type:decimal(32,8);not null" json:"price"`
	Weight      int            `gorm:"column:weight;type:int(11);not null" json:"weight"`
	Type        int            `gorm:"column:type;type:int(11);not null" json:"type"`
	Status      int            `gorm:"column:status;type:int(11);not null" json:"status"`
	Image       string         `gorm:"column:image;type:varchar(256);not null" json:"image"`
	CreatedAt   time.Time      `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
	UpdatedAt   time.Time      `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
	DeletedAt   gorm.DeletedAt `gorm:"column:deleted_at;type:datetime" json:"deleted_at"`
}


type SalesOrder struct {
	ID                int64          `gorm:"primary_key;column:ID;type:bigint(20);not null" json:"id"`
	Serialno          string         `gorm:"column:serialno;type:varchar(64);not null" json:"serialno"`
	Type              int            `gorm:"column:type;type:int(11);not null" json:"type"`
	State             int            `gorm:"column:state;type:int(11);not null" json:"state"`
	MaterialID        int64          `gorm:"column:material_id;type:bigint(20);not null" json:"material_id"`
	CountSales        int            `gorm:"column:count_sales;type:int(11);not null" json:"count_sales"`
	CountTransport    int            `gorm:"column:count_transport;type:int(11);not null" json:"count_transport"`
	BuyerCompanyID    int64          `gorm:"column:buyer_company_id;type:bigint(20);not null" json:"buyer_company_id"`
	BuyerContact      string         `gorm:"column:buyer_contact;type:varchar(32);not null" json:"buyer_contact"`
	BuyerPhone        string         `gorm:"column:buyer_phone;type:varchar(32);not null" json:"buyer_phone"`
	BuyerLocationID   int64          `gorm:"column:buyer_location_id;type:bigint(20);not null" json:"buyer_location_id"`
	SellerCompanyID   int64          `gorm:"column:seller_company_id;type:bigint(20);not null" json:"seller_company_id"`
	SellerWarehouseID int64          `gorm:"column:seller_warehouse_id;type:bigint(20);not null" json:"seller_warehouse_id"`
	CreatedAt         time.Time      `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
	UpdatedAt         time.Time      `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
	DeletedAt         gorm.DeletedAt `gorm:"column:deleted_at;type:datetime" json:"deleted_at"`
}


type SalesOrderCheck struct {
	ID           int64          `gorm:"primary_key;column:ID;type:bigint(20);not null" json:"id"`
	SalesOrderID int64          `gorm:"column:sales_order_id;type:bigint(20);not null" json:"sales_order_id"`
	AccountID    int64          `gorm:"column:account_id;type:bigint(20);not null" json:"account_id"`
	Result       int            `gorm:"column:result;type:int(11);not null" json:"result"`
	CreatedAt    time.Time      `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
	UpdatedAt    time.Time      `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
	DeletedAt    gorm.DeletedAt `gorm:"column:deleted_at;type:datetime" json:"deleted_at"`
}


type SelfPickup struct {
	ID           int64          `gorm:"primary_key;column:ID;type:bigint(20);not null" json:"id"`
	LicensePlate string         `gorm:"column:license_plate;type:varchar(64);not null" json:"license_plate"`
	SalesOrderID int64          `gorm:"column:sales_order_id;type:bigint(20);not null" json:"sales_order_id"`
	CreatedAt    time.Time      `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
	UpdatedAt    time.Time      `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
	DeletedAt    gorm.DeletedAt `gorm:"column:deleted_at;type:datetime" json:"deleted_at"`
}


type StoreInbound struct {
	ID                              int64          `gorm:"primary_key;column:ID;type:bigint(20);not null" json:"id"`
	MaterialID                      int64          `gorm:"column:material_id;type:bigint(20);not null" json:"material_id"`
	MaterialType                    string         `gorm:"column:material_type;type:varchar(32);not null" json:"material_type"`
	MaterialOriginType              string         `gorm:"column:material_origin_type;type:varchar(32);not null" json:"material_origin_type"`
	MaterialOriginMineID            int64          `gorm:"column:material_origin_mine_id;type:bigint(20);not null" json:"material_origin_mine_id"`
	MaterialOriginConfiscateID      int64          `gorm:"column:material_origin_confiscate_id;type:bigint(20);not null" json:"material_origin_confiscate_id"`
	MaterialOriginExternalProjectID int64          `gorm:"column:material_origin_external_project_id;type:bigint(20);not null" json:"material_origin_external_project_id"`
	Weight                          string         `gorm:"column:weight;type:varchar(32);not null" json:"weight"`
	WeightRecordID                  string         `gorm:"column:weight_record_id;type:varchar(32);not null" json:"weight_record_id"`
	Price                           float64        `gorm:"column:price;type:decimal(32,8);not null" json:"price"`
	AssignmentBillID                string         `gorm:"column:assignment_bill_id;type:varchar(32);not null" json:"assignment_bill_id"`
	WarehouseName                   string         `gorm:"column:warehouse_name;type:varchar(32);not null" json:"warehouse_name"`
	WarehouseID                     string         `gorm:"column:warehouse_id;type:varchar(32);not null" json:"warehouse_id"`
	TaskState                       string         `gorm:"column:task_state;type:varchar(32);not null" json:"task_state"`
	TaskNote                        string         `gorm:"column:task_note;type:varchar(32);not null" json:"task_note"`
	TaskType                        string         `gorm:"column:task_type;type:varchar(32);not null" json:"task_type"`
	Applicant                       string         `gorm:"column:applicant;type:varchar(32);not null" json:"applicant"`
	Approver                        string         `gorm:"column:approver;type:varchar(32);not null" json:"approver"`
	CreatedAt                       time.Time      `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
	UpdatedAt                       time.Time      `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
	DeletedAt                       gorm.DeletedAt `gorm:"column:deleted_at;type:datetime" json:"deleted_at"`
}


type StoreLoss struct {
	ID        int64          `gorm:"primary_key;column:ID;type:bigint(20);not null" json:"id"`
	CreatedAt time.Time      `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
	UpdatedAt time.Time      `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime" json:"deleted_at"`
}


type StoreOutbound struct {
	ID                              int64          `gorm:"primary_key;column:ID;type:bigint(20);not null" json:"id"`
	MaterialID                      int64          `gorm:"column:material_id;type:bigint(20);not null" json:"material_id"`
	MaterialType                    string         `gorm:"column:material_type;type:varchar(32);not null" json:"material_type"`
	MaterialSourceType              string         `gorm:"column:material_source_type;type:varchar(32);not null" json:"material_source_type"`
	MaterialOriginMineID            int64          `gorm:"column:material_origin_mine_id;type:bigint(20);not null" json:"material_origin_mine_id"`
	MaterialOriginConfiscateID      int64          `gorm:"column:material_origin_confiscate_id;type:bigint(20);not null" json:"material_origin_confiscate_id"`
	MaterialOriginExternalProjectID int64          `gorm:"column:material_origin_external_project_id;type:bigint(20);not null" json:"material_origin_external_project_id"`
	Weight                          int            `gorm:"column:weight;type:int(11);not null" json:"weight"`
	Price                           float64        `gorm:"column:price;type:decimal(32,8);not null" json:"price"`
	AssignmentBillID                string         `gorm:"column:assignment_bill_id;type:varchar(32);not null" json:"assignment_bill_id"`
	SourceID                        string         `gorm:"column:source_id;type:varchar(32);not null" json:"source_id"`
	WarehouseName                   string         `gorm:"column:warehouse_name;type:varchar(32);not null" json:"warehouse_name"`
	WarehouseID                     string         `gorm:"column:warehouse_id;type:varchar(32);not null" json:"warehouse_id"`
	TaskState                       string         `gorm:"column:task_state;type:varchar(32);not null" json:"task_state"`
	TaskType                        string         `gorm:"column:task_type;type:varchar(32);not null" json:"task_type"`
	TaskNote                        string         `gorm:"column:task_note;type:varchar(32);not null" json:"task_note"`
	Applicant                       string         `gorm:"column:applicant;type:varchar(32);not null" json:"applicant"`
	Approver                        string         `gorm:"column:approver;type:varchar(32);not null" json:"approver"`
	CreatedAt                       time.Time      `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
	UpdatedAt                       time.Time      `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
	DeletedAt                       gorm.DeletedAt `gorm:"column:deleted_at;type:datetime" json:"deleted_at"`
}


type StoreShift struct {
	ID        int64     `gorm:"primary_key;column:ID;type:bigint(20);not null" json:"id"`
	CreatedAt time.Time `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
	UpdatedAt time.Time `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
	Untitled  time.Time `gorm:"column:untitled;type:datetime" json:"untitled"`
}


type StoreStock struct {
	ID                     int64          `gorm:"primary_key;column:ID;type:bigint(20);not null" json:"id"`
	MaterialID             string         `gorm:"column:material_id;type:varchar(32);not null" json:"material_id"`
	MaterialType           string         `gorm:"column:material_type;type:varchar(32);not null" json:"material_type"`
	MaterialSource         string         `gorm:"column:material_source;type:varchar(32);not null" json:"material_source"`
	MaterialSourceLocation string         `gorm:"column:material_source_location;type:varchar(32);not null" json:"material_source_location"`
	Weight                 string         `gorm:"column:weight;type:varchar(32);not null" json:"weight"`
	WarehouseName          string         `gorm:"column:warehouse_name;type:varchar(32);not null" json:"warehouse_name"`
	WarehouseID            string         `gorm:"column:warehouse_id;type:varchar(32);not null" json:"warehouse_id"`
	CreatedAt              time.Time      `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
	UpdatedAt              time.Time      `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
	DeletedAt              gorm.DeletedAt `gorm:"column:deleted_at;type:datetime" json:"deleted_at"`
}


type TransportOrder struct {
	ID                   int64          `gorm:"primary_key;column:ID;type:bigint(20);not null" json:"id"`
	Serialno             string         `gorm:"column:serialno;type:varchar(64);not null" json:"serialno"`
	Type                 int            `gorm:"column:type;type:int(11);not null" json:"type"`
	State                int            `gorm:"column:state;type:int(11);not null" json:"state"`
	DispatchID           int64          `gorm:"column:dispatch_id;type:bigint(20);not null" json:"dispatch_id"`
	WeightExpect         int            `gorm:"column:weight_expect;type:int(11);not null" json:"weight_expect"`
	Weight               int            `gorm:"column:weight;type:int(11);not null" json:"weight"`
	FirstWeightRecordID  int64          `gorm:"column:first_weight_record_id;type:bigint(20);not null" json:"first_weight_record_id"`
	SecondWeightRecordID int64          `gorm:"column:second_weight_record_id;type:bigint(20);not null" json:"second_weight_record_id"`
	DriverID             int64          `gorm:"column:driver_id;type:bigint(20);not null" json:"driver_id"`
	TruckID              int64          `gorm:"column:truck_id;type:bigint(20);not null" json:"truck_id"`
	SourcePhoneNumber    string         `gorm:"column:source_phone_number;type:varchar(32);not null" json:"source_phone_number"`
	TargetPhoneNumber    string         `gorm:"column:target_phone_number;type:varchar(32);not null" json:"target_phone_number"`
	PathID               int64          `gorm:"column:path_id;type:bigint(20);not null" json:"path_id"`
	CreatedAt            time.Time      `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
	UpdatedAt            time.Time      `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
	DeletedAt            gorm.DeletedAt `gorm:"column:deleted_at;type:datetime" json:"deleted_at"`
}


type VehicleIspatch struct {
	ID              int64          `gorm:"primary_key;column:ID;type:bigint(20);not null" json:"id"`
	LogisticsTaskID int64          `gorm:"column:logistics_task_id;type:bigint(20);not null" json:"logistics_task_id"`
	TruckID         int64          `gorm:"column:truck_id;type:bigint(20);not null" json:"truck_id"`
	DriverID        int64          `gorm:"column:driver_id;type:bigint(20);not null" json:"driver_id"`
	CheckID         int64          `gorm:"column:check_id;type:bigint(20);not null" json:"check_id"`
	CreatedAt       time.Time      `gorm:"column:created_at;type:datetime;not null" json:"created_at"`
	UpdatedAt       time.Time      `gorm:"column:updated_at;type:datetime;not null" json:"updated_at"`
	DeletedAt       gorm.DeletedAt `gorm:"column:deleted_at;type:datetime" json:"deleted_at"`
}


type WeightRecord struct {
	ID                int64     `gorm:"primary_key;column:ID;type:bigint(20);not null" json:"id"`
	WeighbridgeID     int64     `gorm:"column:weighbridge_id;type:bigint(20);not null" json:"weighbridge_id"`
	WeighbridgeName   string    `gorm:"column:weighbridge_name;type:varchar(64);not null" json:"weighbridge_name"`
	LicensePlate      string    `gorm:"column:license_plate;type:varchar(64);not null" json:"license_plate"`
	TruckID           int64     `gorm:"column:truck_id;type:bigint(20);not null" json:"truck_id"`
	Weight            int       `gorm:"column:weight;type:int(11);not null" json:"weight"`
	LicensePlateImage string    `gorm:"column:license_plate_image;type:varchar(256);not null" json:"license_plate_image"`
	ImageFront        string    `gorm:"column:image_front;type:varchar(256);not null" json:"image_front"`
	ImageBack         string    `gorm:"column:image_back;type:varchar(256);not null" json:"image_back"`
	SerailNo          string    `gorm:"column:serail_no;type:varchar(64);not null" json:"serail_no"`
	PreviousID        int64     `gorm:"column:previous_id;type:bigint(20);not null" json:"previous_id"`
	Type              int       `gorm:"column:type;type:int(11);not null" json:"type"`
	TimeBegin         time.Time `gorm:"column:time_begin;type:datetime;not null" json:"time_begin"`
	Duration          int       `gorm:"column:duration;type:int(11);not null" json:"duration"`
	TaskSource        string    `gorm:"column:task_source;type:varchar(32);not null" json:"task_source"`
	TaskTarget        string    `gorm:"column:task_target;type:varchar(32);not null" json:"task_target"`
	ConfiscateID      int64     `gorm:"column:confiscate_id;type:bigint(20);not null" json:"confiscate_id"`
	InboundID         int64     `gorm:"column:inbound_id;type:bigint(20);not null" json:"inbound_id"`
	OutboundID        int64     `gorm:"column:outbound_id;type:bigint(20);not null" json:"outbound_id"`
}
